home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / dviware / ln03 / rmcs / texprint.com < prev   
Text File  |  1991-10-01  |  4KB  |  145 lines

  1. $!- TEXPRINT.COM ---------------------------------------------------------------
  2. $!  ~~~~~~~~~~~~
  3. $!  Command file to print a file to the laser printer queue designated by
  4. $!  P1.
  5. $!
  6. $!  This command procedure is invoked by the user typing TEXPRINT followed
  7. $!  by the name(s) of the file(s) to be printed.  The login procedures
  8. $!  executed by users of TeX/LaTeX should arrange to define the DCL symbol
  9. $!  TEXPRINT thus:
  10. $!        $ TEXP*rint :== @TEX_COM:TEXPRINT devname
  11. $!  where devname is the name of the output device's queue; as published,
  12. $!  this procedure assumes that the full name of the queue is given by
  13. $!  devname+"$LASER"
  14. $!  
  15. $!  Parameters:
  16. $!
  17. $!    P1    (required)  The name of the queue to be used for printing
  18. $!    P2    (required)  Name of file(s) to be printed and/or optional
  19. $!                        qualifiers.  If this consists of qualifiers,
  20. $!                they are placed globally, and the filename must
  21. $!                follow in P3... Multiple file names should be
  22. $!                separated by commas
  23. $!    P3-P8    (optional)  Further optional qualifiers, which will be
  24. $!                appended to the last filename used.
  25. $!------------------------------------------------------------------------------
  26. $!
  27. $! Ensure printer queue specified
  28. $! 
  29. $     SAY := WRITE SYS$OUTPUT
  30. $    IF P1 .EQS. ""
  31. $    THEN
  32. $        SAY "%TEXPRINT-F-NOQUEUE, No laser printer queue specified"
  33. $        EXIT %X10000004
  34. $    ENDIF
  35. $    queue_name = P1 + "$LASER"
  36. $    xxx = F$GETQUI("DISPLAY_QUEUE","QUEUE_STATUS",queue_name)
  37. $    IF xxx .EQS. ""
  38. $    THEN
  39. $        SAY "%TEXPRINT-F-BADQUEUE, No such queue ''queue_name'"
  40. $        EXIT %X10000004
  41. $    ENDIF
  42. $!
  43. $! Ensure file name specified
  44. $! 
  45. $Get_Name:
  46. $     IF P2 .EQS. ""
  47. $    THEN 
  48. $        INQUIRE P2 "_File name"
  49. $        GOTO Get_Name
  50. $    ENDIF
  51. $!
  52. $! Extract leading qualifier or single filename from P2...
  53. $! 
  54. $    param_ctr = 2
  55. $    had_name = "FALSE"
  56. $    global_qual = ""
  57. $    file_list = ""
  58. $    related_spec = ".LN3"
  59. $    had_warning = "FALSE"
  60. $Next_Param:
  61. $    next_par = F$EDIT(P'param_ctr,"TRIM,UPCASE")
  62. $     first_part = F$ELEMENT(0,",",next_par)
  63. $    following = F$ELEMENT(1,",",next_par) .NES. ","
  64. $!
  65. $! If Pn starts with a "/", it must be a global qualifier, if we haven't
  66. $! yet had any file names, or a trailing qualifier after the last file.
  67. $! 
  68. $    IF F$EXTRACT(0,1,first_part) .EQS. "/"
  69. $    THEN
  70. $        IF had_name
  71. $        THEN
  72. $        file_list = file_list + next_par
  73. $        param_ctr = param_ctr + 1
  74. $        IF param_ctr .GT. 8 THEN $ GOTO Print_It
  75. $        GOTO Next_Param
  76. $        ENDIF
  77. $        global_qual = global_qual + next_par
  78. $        param_ctr = param_ctr + 1
  79. $        IF param_ctr .GT. 8
  80. $        THEN
  81. $        SAY "%TEXPRINT-E-NOFILES, No files selected for printing"
  82. $        EXIT %X10000002
  83. $        ENDIF
  84. $        GOTO Next_Param
  85. $    ENDIF
  86. $!
  87. $! Otherwise, what's in first_part is a filename, with an optional trailing
  88. $! qualifier (local to that file).
  89. $!
  90. $    IF had_name
  91. $    THEN
  92. $        SAY "%TEXPRINT-W-PARAMS, Too many parameters \''next_par'\"
  93. $        had_warning = "TRUE"
  94. $        param_ctr = param_ctr + 1
  95. $        IF param_ctr .GT. 8 THEN $ GOTO Print_It
  96. $        GOTO Next_Param
  97. $    ENDIF
  98. $!
  99. $! Extract file name preceding any local qualifiers, and default to .LN3
  100. $!
  101. $    elem_ctr = 1
  102. $Next_Element:
  103. $    file_name = F$ELEMENT(0,"/",first_part)
  104. $    first_part = first_part - file_name
  105. $    next_file = F$PARSE(file_name,,related_spec,,"SYNTAX_ONLY")
  106. $    IF F$SEARCH(next_file) .EQS. ""
  107. $    THEN 
  108. $        SAY "%TEXPRINT-W-NOSUCHFILE, Couldn't find file ''next_file'"
  109. $        had_warning = "TRUE"
  110. $    ELSE
  111. $        had_name = "TRUE"
  112. $        IF file_list .NES. "" THEN $ file_list = file_list + ","
  113. $        file_list = file_list + next_file + first_part
  114. $        related_spec = next_file
  115. $    ENDIF
  116. $!
  117. $! Now go back for next element of next_par, if applicable
  118. $!
  119. $    IF .NOT. following then $ GOTO Print_It
  120. $     first_part = F$ELEMENT(elem_ctr,",",next_par)
  121. $    elem_ctr = elem_ctr + 1
  122. $    following = F$ELEMENT(elem_ctr,",",next_par) .NES. ","
  123. $    GOTO Next_Element
  124. $!
  125. $! We've got everything required to execute the print command
  126. $!
  127. $Print_It:
  128. $    IF .NOT. had_name
  129. $    THEN
  130. $        SAY "%TEXPRINT-F-CREJOB, error creating job"
  131. $        SAY "-JBC-E-EMPTYJOB, no files specified in job request"
  132. $        EXIT %X10000004
  133. $    ENDIF
  134. $!
  135. $! The queue itself decides whether we print a flag page or not
  136. $!
  137. $    PRINT/QUEUE='P1'$LASER/FORM=PLOT$FORM/NOHEADER/NOFEED -
  138.         'global_qual' 'file_list'
  139. $    print_stat = $STATUS
  140. $    IF .NOT. print_stat THEN $ EXIT print_stat
  141. $    IF had_warning THEN $ EXIT %X10000000
  142. $     EXIT %X10000001
  143. $!
  144. $!- END OF TEXPRINT.COM --------------------------------------------------------
  145.